<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------

//define('ApiConfigAccessControlAllowHeaders', "origin,x-requested-with,content-type,accept,auth,token");
//header('Access-Control-Allow-Origin: *');
//header("Access-Control-Allow-Credentials: true");
//header("Access-Control-Allow-Methods: PUT, POST, GET, OPTIONS, DELETE");
//header("Access-Control-Max-Age: 3600");
//header("Access-Control-Allow-Headers:" . ApiConfigAccessControlAllowHeaders);

//Route::get('think', function () {
//    return 'hello,ThinkPHP5!';
//});
//
//
use think\facade\Route;

Route::group('', function () {
    // 获取公众号授权链接
    Route::rule('applets/Authorize', 'appletsapi/Login/Authorize');
    // 通过 code 换取网页授权信息
    Route::rule('applets/Authlogin', 'appletsapi/Login/Authlogin');
    // 商品列表
    Route::rule('applets/productlist', 'appletsapi/Products/ProductList');
    // 搜索商品列表
    Route::rule('applets/selectlist', 'appletsapi/Products/SelectList');
    // 商铺详情
    Route::rule('applets/shopinfo', 'appletsapi/Products/Shopinfo');
    // 用户购物车列表
    Route::rule('applets/usercartlist', 'appletsapi/Cart/UserCartList');
    // 用户删除购物车
    Route::rule('applets/userdelcart', 'appletsapi/Cart/UserDelCart');
    // 用户编辑购物车
    Route::rule('applets/usereditcart', 'appletsapi/Cart/UserEditCart');
    // 结算页面
    Route::rule('applets/Settlement', 'appletsapi/Order/Settlement');
    // 下单
    Route::rule('applets/GoToPlace', 'appletsapi/Place/GoToPlace');
    // 线下订单列表
    Route::rule('applets/getofflineorderlist', 'appletsapi/Order/GetOfflineOrderList');
    // 线下订单详情
    Route::rule('applets/getofflineorderdetail', 'appletsapi/Order/GetOfflineOrderDetail');
    // 用户撤销订单
    Route::rule('applets/usercancel', 'appletsapi/Order/UserCancel');
    // 取消撤销订单
    Route::rule('applets/usercanceloperation', 'appletsapi/Order/UserCancelOperation');
    // 用户修改订单
    Route::rule('applets/UserEditOrder', 'appletsapi/Order/UserEditOrder');

})->allowCrossDomain(true,['Access-Control-Allow-Origin' => '*',
    'Access-Control-Allow-Methods' => 'OPTIONS,POST,GET,DELETE,PUT',
    'Access-Control-Allow-Credentials' => 'true',
    'Access-Control-Allow-Headers' => 'AccessToken,RefreshToken,Content-Type,Origin,Referer,token',]);